<div class="margin-content">
  <div class="videos-header">
    <h1 *ngIf="displayTitle" class="title" placement="bottom" [ngbTooltip]="titleTooltip" container="body">
      {{ title }}
    </h1>

    <div *ngIf="syndicationItems" [ngClass]="{ 'no-title': !displayTitle }" class="title-subscription">
      <ng-container i18n>Subscribe to RSS feed "{{ title }}"</ng-container>

      <my-feed [syndicationItems]="syndicationItems"></my-feed>
    </div>

    <div class="action-block">
      <ng-container *ngFor="let action of headerActions">
        <a *ngIf="action.routerLink" class="ml-2" [routerLink]="action.routerLink" routerLinkActive="active">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </a>

        <a *ngIf="!action.routerLink && !action.href && action.click" class="ml-2" (click)="action.click($event)" (key.enter)="action.click($event)">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </a>

        <a *ngIf="!action.routerLink && action.href && action.click" class="ml-2" (click)="action.click($event)" (key.enter)="action.click($event)" [href]="action.href">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </a>

        <ng-template #actionContent let-action>
          <my-button *ngIf="!action.justIcon" [icon]="action.iconName" [label]="action.label"></my-button>
          <my-button *ngIf="action.justIcon" [icon]="action.iconName" [ngbTooltip]="action.label"></my-button>
        </ng-template>
      </ng-container>
    </div>
  </div>

  <my-video-filters-header
    *ngIf="displayFilters" [displayModerationBlock]="displayModerationBlock" [hideScope]="hideScopeFilter"
    [filters]="filters"
    (filtersChanged)="onFiltersChanged(true)"
  ></my-video-filters-header>

  <div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0">No results.</div>
  <div
    myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"
    [setAngularState]="true" [parentDisabled]="disabled"
    class="videos" [ngClass]="{ 'display-as-row': displayAsRow }"
  >
    <ng-container *ngFor="let video of videos; trackBy: videoById;">
      <h2 class="date-title" *ngIf="getCurrentGroupedDateLabel(video)">
        {{ getCurrentGroupedDateLabel(video) }}
      </h2>

      <div class="video-wrapper">
        <my-video-miniature
          [video]="video" [user]="userMiniature" [displayAsRow]="displayAsRow"
          [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
          (videoBlocked)="removeVideoFromArray(video)" (videoRemoved)="removeVideoFromArray(video)"
        >
        </my-video-miniature>
      </div>
    </ng-container>
  </div>
</div>
